package com.college.authority.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.college.authority.service.UmsResourceCategoryService;
import com.college.authority.mapper.UmsResourceCategoryMapper;
import com.college.common.pojo.ao.UmsResourceCategory;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 后台资源分类管理Service实现类
 * Created by macro on 2020/2/5.
 */
@Service
public class UmsResourceCategoryServiceImpl extends ServiceImpl<UmsResourceCategoryMapper, UmsResourceCategory> implements UmsResourceCategoryService {

	@Override
	public List<UmsResourceCategory> listAll() {
		QueryWrapper<UmsResourceCategory> wrapper = new QueryWrapper<>();
		wrapper.lambda().orderByDesc(UmsResourceCategory::getSort);
		return list(wrapper);
	}

	@Override
	public boolean create(UmsResourceCategory umsResourceCategory) {
		umsResourceCategory.setCreateTime(new Date());
		return save(umsResourceCategory);
	}
}
